
-- =============================================
-- Author:		Christopher Navarro	
-- Create date: 9/12/12
-- Description:	Busca un blog por el ID del usuario
-- =============================================
CREATE PROCEDURE BuscarBlog
	-- Add the parameters for the stored procedure here
	@id_usario int
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    SELECT	b.id_blog,
		b.estado,
		u.nombre+' '+u.apellido1+' '+u.apellido2 NombreCompleto,
		r.nombre rol

FROM tblog b
	INNER JOIN tusuario u on u.id_Usuario = b.id_usuario
	INNER JOIN trol_usuario rs on u.id_Usuario = rs.id_usuario
	INNER JOIN trol r on rs.id_rol = r.id_rol
	
WHERE b.id_usuario = @id_usario

END
GO
